package me.zhengjie.modules.company.domain;

import me.zhengjie.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;
import java.sql.Timestamp;

/**
* @author TianI
* @date 2022-01-21
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("company")
public class Company extends CommonModel<Company> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "总公司主键id")
    @TableId(type= IdType.ASSIGN_ID)
    private Long companyId;

    @ApiModelProperty(value = "总公司名称")
    private String companyName;

    @ApiModelProperty(value = "总公司品牌logo路径")
    private String companyBrandLogoUrl;

    @ApiModelProperty(value = "总公司首页轮播图")
    private String companyBannerUrl;

    @ApiModelProperty(value = "总公司首页展示视频路径")
    private String companyVideoUrl;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "手机号")
    private String phone;

    public void copyFrom(Company source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
